Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Improve e2e test setup error reporting #1943

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aThorp96
Copy link
Contributor

  • collect required environment variable checks into one place
  • report all missing required env-vars instead of just the first failure

Changes

Submitter Checklist

  • 📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).

  • ♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.

  • ✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).

  • 📖 Document any user-facing features or changes in behavior.

  • 🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.

  • 🎁 If feasible, add an end-to-end test. See README for details.

  • 🔎 Address any CI test flakiness before merging, or provide a valid reason to bypass it (e.g., token rate limitations).

  • If adding a provider feature, fill in the following details:

Git Provider Supported
GitHub App ✅️
GitHub Webhook ❌️
Gitea ❌️
GitLab ❌️
Bitbucket Cloud ❌️
Bitbucket Server ❌️

(update the documentation accordingly)

@aThorp96 aThorp96 marked this pull request as draft February 17, 2025 20:47
@aThorp96 aThorp96 force-pushed the improve-e2e-test-setup-env-validation branch from b41ff42 to d41fede Compare February 18, 2025 17:18
@aThorp96
Copy link
Contributor Author

/retest go-testing

@aThorp96 aThorp96 marked this pull request as ready for review February 19, 2025 18:51
"os"
)

func RequireEnvs(keys ...string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func RequireEnvs(keys ...string) error {
// RequireEnvs checks if all required environment variables are set.
// It takes a variadic list of environment variable keys and returns an error
// if any of the required variables are not set.
func RequireEnvs(keys ...string) error {

return nil
}

func GetRequiredEnv(key string) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func GetRequiredEnv(key string) (string, error) {
// GetRequiredEnv retrieves the value of a required environment variable.
// If the environment variable is not set or is empty, it returns an error.
func GetRequiredEnv(key string) (string, error) {

@chmouel
Copy link
Member

chmouel commented Feb 20, 2025

LGTM, not absolutely necessary just maybe add some documentation on function...

@aThorp96 aThorp96 force-pushed the improve-e2e-test-setup-env-validation branch from d41fede to e9f2bde Compare February 20, 2025 12:58
@vdemeester
Copy link
Member

/lgtm

Copy link

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Pull Request Approved

Approval Status:

  • Required Approvals: 1
  • Current Approvals: 2

👥 Approved By:

Reviewer Permission Status
@chmouel admin
@vdemeester admin

📝 Next Steps

  • All required checks must pass
  • Branch protection rules apply
  • Get a maintainer to use the /merge command to merge the PR

Thank you for your contributions! 🎉

@aThorp96
Copy link
Contributor Author

/merge

Copy link

🔒 Insufficient Permissions

  • User @aThorp96 does not have permission to merge
  • Current permission level: read
  • Required permissions: admin, write

Please request assistance from a repository maintainer.

- collect required environment variable checks into one place
- report all missing required env-vars instead of just the first failure
@aThorp96 aThorp96 force-pushed the improve-e2e-test-setup-env-validation branch from e9f2bde to d4c2938 Compare February 20, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants